package com.dandandog.framework.common.config;

import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextListener;

import java.util.EventListener;

/**
 * @Author: JohnnyLiu
 * @Date: 2021/11/17 11:23
 */
@Configuration
public class CommonConfig {

    @Bean
    public ServletListenerRegistrationBean<RequestContextListener> requestContextListener() {
        ServletListenerRegistrationBean<RequestContextListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
        RequestContextListener listener = new RequestContextListener();
        listenerRegistrationBean.setListener(listener);
        return listenerRegistrationBean;
    }

}
